# Contributor: Mike Crute <mike@crute.us>
# Maintainer: Mike Crute <mike@crute.us>
pkgname=prometheus-smokeping-prober
_pkgname=smokeping_prober
pkgver=0.7.1
pkgrel=7
pkgdesc="Prometheus style smokeping prober"
url="https://github.com/SuperQ/smokeping_prober"
license="Apache-2.0"
arch="all"
options="!check" # no testsuite
makedepends="go"
pkgusers="prometheus"
pkggroups="prometheus"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-openrc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/SuperQ/smokeping_prober/archive/v$pkgver.tar.gz
	smokeping-prober.initd
	smokeping-prober.confd
	"
builddir="$srcdir/$_pkgname-$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build \
		-ldflags "-X github.com/prometheus/common/version.Version=$pkgver" \
		-v -o smokeping_prober
}

package() {
	install -Dm755 smokeping_prober "$pkgdir"/usr/bin/smokeping_prober

	install -Dm755 "$srcdir"/smokeping-prober.initd "$pkgdir"/etc/init.d/smokeping-prober
	install -Dm644 "$srcdir"/smokeping-prober.confd "$pkgdir"/etc/conf.d/smokeping-prober
}

sha512sums="
074a38e29b93687498e6a796257e625b0b15ec6fa2181eec0a82b9d5e4c9efc78a5de567525c8b78dec6d1adde0b34b2bd6e96b450eeb05e3d68d8fc1c6c5716  smokeping_prober-0.7.1.tar.gz
6a551247df6dfa2b5bfbb9a36e181ea685679208dc44401eb24cf3904dac7f7974c974d45878c3ee88e1b9e562f6355d942d28b1ec8513439e603e06f7f07352  smokeping-prober.initd
a29cb9e49fc3a0be67368b9f8764a88563f600a29ebc5ee40629d1da96ca28034e73af18d9d1f0c9c77b9c75fa67c3d2dd5af3d233ee0dc9e9bfd89bcf60b60a  smokeping-prober.confd
"
